package com.jie.mq.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @description:消费者通用配置
 * @author: jie
 * @time: 2022/2/25 14:50
 */
@Slf4j
@Configuration
public class CommonConfig{

    /**
     * @description:创建队列simple.queue
     * @author: jie
     * @time: 2022/2/25 14:58
     */
    @Bean
    public Queue fanoutQueue1(){
        return new Queue("simple.queue");
    }

    @Bean
    public DirectExchange simpleExchange(){
        // 三个参数：交换机名称、是否持久化、当没有queue与其绑定时是否自动删除
        return new DirectExchange("simple.direct", true, false);
    }


}
